package com.goodluck.goodluckim.db.greendao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.goodluck.goodluckim.db.model.IMMessage;
import com.goodluck.goodluckim.db.model.RecentSession;
import com.goodluck.goodluckim.db.model.TeamMember;

import com.goodluck.goodluckim.db.greendao.IMMessageDao;
import com.goodluck.goodluckim.db.greendao.RecentSessionDao;
import com.goodluck.goodluckim.db.greendao.TeamMemberDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig iMMessageDaoConfig;
    private final DaoConfig recentSessionDaoConfig;
    private final DaoConfig teamMemberDaoConfig;

    private final IMMessageDao iMMessageDao;
    private final RecentSessionDao recentSessionDao;
    private final TeamMemberDao teamMemberDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        iMMessageDaoConfig = daoConfigMap.get(IMMessageDao.class).clone();
        iMMessageDaoConfig.initIdentityScope(type);

        recentSessionDaoConfig = daoConfigMap.get(RecentSessionDao.class).clone();
        recentSessionDaoConfig.initIdentityScope(type);

        teamMemberDaoConfig = daoConfigMap.get(TeamMemberDao.class).clone();
        teamMemberDaoConfig.initIdentityScope(type);

        iMMessageDao = new IMMessageDao(iMMessageDaoConfig, this);
        recentSessionDao = new RecentSessionDao(recentSessionDaoConfig, this);
        teamMemberDao = new TeamMemberDao(teamMemberDaoConfig, this);

        registerDao(IMMessage.class, iMMessageDao);
        registerDao(RecentSession.class, recentSessionDao);
        registerDao(TeamMember.class, teamMemberDao);
    }
    
    public void clear() {
        iMMessageDaoConfig.clearIdentityScope();
        recentSessionDaoConfig.clearIdentityScope();
        teamMemberDaoConfig.clearIdentityScope();
    }

    public IMMessageDao getIMMessageDao() {
        return iMMessageDao;
    }

    public RecentSessionDao getRecentSessionDao() {
        return recentSessionDao;
    }

    public TeamMemberDao getTeamMemberDao() {
        return teamMemberDao;
    }

}
